import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path:'/',           //这个表示的是根目录，即一进入的页面
    redirect:'/index'    //设置页面一进来就显示的页面，即重定向到goods组件，这里写的内容是对应组将的component的值
  },
  {
    path: '/Home',
    name: 'Home',
    component: () => import('../views/Home.vue')
  },
  {
    path: '/About',
    name: 'About',
    component: () => import('../views/About.vue')
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('../views/StockInfoDTOIndex.vue')
  },
  {
    path: '/stockChange',
    name: 'StockChange',
    component: () => import('../views/StockChange.vue')
  }
];

const router = new VueRouter({
  
  mode: "hash",
  routes
});

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router;